/*
包含n个接口请求函数的模块
函数的返回值: promise对象
 */
import ajax from './ajax'

const baseUrl = '/api'
const userControllerUrl = `${baseUrl}/user`
const bookControllerUrl = `${baseUrl}/book`
export const createCodeImage = `${baseUrl}/image/createImage`
const loginUrl = `${userControllerUrl}/login`
const registerUrl = `${userControllerUrl}/register`
const findBookPageUrl = `${bookControllerUrl}/findPage`
const addBookUrl = `${bookControllerUrl}/addBook`


export const login = ({username,password,code}) => ajax(loginUrl,{username,password,code},'POST')
export const register = ({username,password}) => ajax(registerUrl,{username,password},'POST')
export const findBookPage = ({pageNum,pageSize}) => ajax(findBookPageUrl,{pageNum,pageSize},'POST')
export const addBook = ({name,author,price}) => ajax(addBookUrl,{name,author,price},'POST')




